import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: () => import('@/views/home/home.vue'),
    meta:{
      title:"单位食安指数公示"
    }
  },

  {
    path: '/unscramble',
    name: 'unscramble',
    component: () => import('@/views/home/unscramble.vue'),
    meta:{
      title:"食安指数解析"
    }
  },
  {
    path: '/publicity',
    name: 'publicity',
    component: () => import('@/views/home/publicity.vue'),
    meta:{
      title:"一扫“苏食安”,食安信息“码”上见"
    }
  },
  {
    path: '/workstation',
    name: 'workstation',
    component: () => import('@/views/home/workstation.vue'),
    meta:{
      title:"一扫“苏食安”,食安信息“码”上见"
    }
  },

  {
    path: '/chainStore',
    name: 'chainStore',
    component: () => import('@/views/home/chainStore.vue'),
    meta:{
      title:"一扫“苏食安”,食安信息“码”上见"
    }
  },
  {
    path: '/inspect',
    name: 'inspect',
    component: () => import('@/views/home/inspect.vue'),
    meta:{
      title:"检查详情"
    }
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/home/404.vue'),
    meta:{
      title:"温馨提示"
    }
  },
  

  
]

const router = new VueRouter({
  routes
})
router.beforeEach((to, from, next) => {
      if(to.meta.title) document.title=to.meta.title||""
      next()
})
export default router
